import user from './user'

/**
 * 接口添加 host
 * @param {Object} url
 * @param {String} publicUrl
 * @returns {Object}
 */
function fixUrl (url, publicUrl) {
  let _publicUrl = publicUrl || process.env.BASE_URL
  let _url = {}
  let key
  for (key in url) {
    if (url.hasOwnProperty(key)) {
      _url[key] = _publicUrl + url[key]
    }
  }
  return _url
}

const api = {
  static: {
    image: process.env.VUE_APP_IMGURL
  },
  user: fixUrl(user)
}

export default api
